<?php

class HomePage extends MY_Controller {

	function HomePage()
	{
		parent::MY_Controller();
	}
	/**
	 * 首页
	 */
	function index()
	{
	    //品牌即将
	    $brand=($_GET['brand']=="2"?"2":"1");
	    $this->viewData['brand'] = $brand;
	    
	    $where = array();
	    if ($_SESSION['DLRSTATE_SYS']=="101" or $_SESSION['DLRSTATE_SYS']=="11"){
	        $where['NewsUserType'] = 2;
	        $_SESSION['isQiCheng'] = 1;
	    }elseif($_SESSION['DLRSTATE_SYS']=="102"){
        	if($_GET['brand']=="2")
        	{
        	    $where['NewsUserType'] = 2;
        		$_SESSION['isQiCheng'] = 1;
        	}elseif($_GET['brand']=="1"){
        	    $where['NewsUserType'] = 1;
        		$_SESSION['isQiCheng'] = 0;
        	}
        }else{
            $where['NewsUserType'] = 1;
        	$_SESSION['isQiCheng'] = 0;
        }
        if($brand==2)
        {
            $xin_wen1="12";
            $xin_wen2="35";
        
        }else{
            $xin_wen1="1";
            $xin_wen2="24";
        }
        $this->load->model('jurSellpointModel');
        $jurSellpointFind = $this->jurSellpointModel->getList(array('SellPointID'=>$_SESSION['DLRID'],'application_system_id' => array('in', array($xin_wen1,$xin_wen2))));
        $importNewsList = array();
        $importNoticeList = array();
        if ($jurSellpointFind){
            //重要新闻
            $this->load->model('pvNewsModel');
            $where['NewsDisplay'] = 1;
            $where['NewsClass'] = 1;
            $importNewsList = $this->pvNewsModel->getNewList($where,7,'','','OrderByNumber desc, `CreateDate` DESC');
            //重要公告
            $where['NewsDisplay'] = 1;
            $where['NewsClass'] = 2;
            $importNoticeList = $this->pvNewsModel->getNewList($where,7,'','','OrderByNumber desc, `CreateDate` DESC');
        }
        $this->viewData['importNewsList'] = $importNewsList;
        $this->viewData['importNoticeList'] = $importNoticeList;
		$this->load->view('HomePage/index', $this->viewData);
	}
	/**
	 * 页面提示
	 */
	function notice(){
	    //执行反馈页面提示
	    $implement2016Json = file_get_contents('http://'.$_SERVER['HTTP_HOST'].'/implement2016/index.php?c=Main&m=notice');
	    echo $implement2016Json;exit;
	    //是否为ajax请求
	    if (isAjax()){
	        
	    }else{
	        
    	    $this->load->view('HomePage/notice', $this->viewData);
	    }
	}
	/**
	 * rmp2015选择
	 */
	function rmp2015(){
	    $this->load->view('HomePage/rmp2015');
	}
	/**
	 * rmp2016选择
	 */
	function rmp2016(){
	    
	    $this->load->view('HomePage/rmp2016');
	}
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */